<?php

namespace apiend\modules\inventory\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\inventory\models\BatchForm;
use common\models\inventory\InventoryLog;
use common\models\inventory\InventoryBill;
use common\models\inventory\InventoryBatch;

/**
 * 获取判断结果相关接口
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class ResultController extends Controller {

    public $modelClass = 'apiend\modules\inventory\models\InventoryResultLogic';

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            '*' => ['GET'],
        ];
    }

    /**
     * 当前招募活动
     * @inheritdoc
     */
    public function actionIndex($id) {
        $batch = InventoryBatch::findOne($id);
        if (!$batch) {
            parent::error('批次信息不存在');
        }
        /* @var $modelClass \apiend\modules\inventory\models\InventoryResultLogic */
        $model = new $this->modelClass;
        $model->setBatch($batch);
        return $model->toArray();
    }

}
